package com.qm.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 @author james
 @create 2021-03-12 10:52
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class QmResult {

    private Integer status;     //如果后端服务器运行正常 返回200 否则返回201 表示失败
    private String msg;         //服务器返回提示
    private Object data;        //服务器返回业务数据.


    public static QmResult fail() {
        return new QmResult(201,"服务器异常请求稍后",null);
    }

    public static QmResult fail(Integer status, String msg) {
        return new QmResult(status,msg,null);
    }

    public static QmResult success() {
        return new QmResult(200,"服务器执行成功",null);
    }

    public static QmResult success(Object data) {
        return new QmResult(200,"服务器执行成功",data);
    }

    public static QmResult success(String msg, Object data) {
        return new QmResult(200, msg, data);
    }
}
